package com.boarsoft.message.rocketmq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Mac_J
 *
 */
public class RocketMQDestination {
	private static final Logger log = LoggerFactory.getLogger(RocketMQDestination.class);

	/** */
	protected RocketMQProducer producer;
	/** */
	protected RocketMQConsumer consumer;

	/** */
	protected String code;

	public void close() {
		if (producer != null) {
			try {
				producer.close();
			} catch (Exception e) {
				log.warn("Error on close producer {}", producer, e);
			}
		}
		if (consumer != null) {
			try {
				consumer.close();
			} catch (Exception e) {
				log.warn("Error on close consumer {}", consumer, e);
			}
		}
	}

	public RocketMQProducer getProducer() {
		return producer;
	}

	public void setProducer(RocketMQProducer producer) {
		this.producer = producer;
	}

	public void setConsumer(RocketMQConsumer consumer) {
		this.consumer = consumer;
	}

	public RocketMQConsumer getConsumer() {
		return consumer;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
}
